package com.ygqh.baby.config;

import com.wdt.api.DefaultWdtClient;
import com.wdt.api.WdtClient;
import com.wdt.yiigoo.DefaultConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author: sunshuo
 * @date: 2019/2/27 14:56
 */
@Configuration
@PropertySource("classpath:prop/wdt.properties")
public class WdtQybConfiguration {

    @Value("${shop_no}")
    private String shopNo;

    @Value("${warehouse_no}")
    private String warehouseNo;

    @Value("${app_secret}")
    private String appSecret;

    @Value("${app_key}")
    private String appKey;

    @Value("${sid}")
    private String sid;

    @Value("${api_base_url}")
    private String apiBaseUrl;

    @Bean
    public WdtQybConfig wdtQybConfig() {
        return new WdtQybConfig(shopNo, warehouseNo, appSecret, appKey, sid, apiBaseUrl);
    }

    @Bean
    public WdtClient wdtClient() {
        return new DefaultWdtClient(DefaultConfig.wdtConfig, DefaultConfig.taoBaoConfig);
    }

}
